import request from '@/config/axios'

// ERP辅料管理-辅料物料报价单 VO
export interface PurAccessoryMaterialQuotationVO {
  id: string // 报价单ID
  quotationNo: string // 报价单号
  supplierId: string // 供应商ID
  supplierCode: string // 供应商编号
  supplierName: string // 供应商名称
  date: Date // 日期
  isApproved: boolean // 审核
  approvalTime: Date // 审核时间
  approver: string // 审核人
  remark: string // 备注
}

// ERP辅料管理-辅料物料报价单 API
export const PurAccessoryMaterialQuotationApi = {
  // 查询ERP辅料管理-辅料物料报价单分页
  getPurAccessoryMaterialQuotationPage: async (params: any) => {
    return await request.get({ url: `/erp/pur-accessory-material-quotation/page`, params })
  },

  // 查询ERP辅料管理-辅料物料报价单详情
  getPurAccessoryMaterialQuotation: async (id: number) => {
    return await request.get({ url: `/erp/pur-accessory-material-quotation/get?id=` + id })
  },

  // 新增ERP辅料管理-辅料物料报价单
  createPurAccessoryMaterialQuotation: async (data: PurAccessoryMaterialQuotationVO) => {
    return await request.post({ url: `/erp/pur-accessory-material-quotation/create`, data })
  },

  // 修改ERP辅料管理-辅料物料报价单
  updatePurAccessoryMaterialQuotation: async (data: PurAccessoryMaterialQuotationVO) => {
    return await request.put({ url: `/erp/pur-accessory-material-quotation/update`, data })
  },

  // 删除ERP辅料管理-辅料物料报价单
  deletePurAccessoryMaterialQuotation: async (id: number) => {
    return await request.delete({ url: `/erp/pur-accessory-material-quotation/delete?id=` + id })
  },

  // 导出ERP辅料管理-辅料物料报价单 Excel
  exportPurAccessoryMaterialQuotation: async (params) => {
    return await request.download({ url: `/erp/pur-accessory-material-quotation/export-excel`, params })
  },

// ==================== 子表（ERP辅料管理-辅料物料报价单明细） ====================

  // 获得ERP辅料管理-辅料物料报价单明细分页
  getPurAccessoryMaterialQuotationDetailPage: async (params) => {
    return await request.get({ url: `/erp/pur-accessory-material-quotation/pur-accessory-material-quotation-detail/page`, params })
  },
  // 新增ERP辅料管理-辅料物料报价单明细
  createPurAccessoryMaterialQuotationDetail: async (data) => {
    return await request.post({ url: `/erp/pur-accessory-material-quotation/pur-accessory-material-quotation-detail/create`, data })
  },

  // 修改ERP辅料管理-辅料物料报价单明细
  updatePurAccessoryMaterialQuotationDetail: async (data) => {
    return await request.put({ url: `/erp/pur-accessory-material-quotation/pur-accessory-material-quotation-detail/update`, data })
  },

  // 删除ERP辅料管理-辅料物料报价单明细
  deletePurAccessoryMaterialQuotationDetail: async (id: number) => {
    return await request.delete({ url: `/erp/pur-accessory-material-quotation/pur-accessory-material-quotation-detail/delete?id=` + id })
  },

  // 获得ERP辅料管理-辅料物料报价单明细
  getPurAccessoryMaterialQuotationDetail: async (id: number) => {
    return await request.get({ url: `/erp/pur-accessory-material-quotation/pur-accessory-material-quotation-detail/get?id=` + id })
  }
}